package com.atguigu.Test02;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package com.atguigu.Test02
 * @date 2024/4/22 下午12:07
 */
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON)//单例
//@Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)//多例
@Component
public class JavaBean {
    @PostConstruct
    public void init(){
        System.out.println("init!");
    }
    @PreDestroy
    public void  destroy(){
        System.out.println("destroy!");
    }
}
